package com.qfedu.firstpage.filter;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration // 标记当前类是一个配置类
public class InterceptorConfig extends WebMvcConfigurerAdapter {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        // 注册拦截器 addPathPatterns添加拦截路径 /**代表拦截所有路径 excludePathPatterns代表排除指定访问路径
        registry.addInterceptor(new TokenFilter()).addPathPatterns("/**").excludePathPatterns("/login","/Register");

        super.addInterceptors(registry);
    }
}
